package com.leetcode.partition4;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/4/11 9:19
 */
public class LC357统计各位数字都不同的数字个数 {

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        writer.write(countNumbersWithUniqueDigits(Integer.parseInt(reader.readLine())) + "\n");
        writer.flush();
    }

    public static int countNumbersWithUniqueDigits(int n) {
        if (n == 0) return 1;
        int ans = 10;
        for (int i = 2, last = 9; i <= n; i++) {
            //位数为i位可以凑出的满足题意的数目
            int cur = last * (10 - i + 1);
            ans += cur;
            last = cur;
        }
        return ans;
    }
}
